## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.

## Authors: L. Finos, M. Redaelli

source("eval_ltp.R")

test.EvalItemValue <- function() {
  project.path <- "projects/sample"
  
  e1     <- EvalItemValue(project.path, keys=c("IT"), value="VALUE1")
  e1.bis <- EvalItemFromProjectData(project.path, keys=c("IT"), value="VALUE1")
  checkEquals(
              e1,
              e1.bis
              )
  checkEquals(
              c(5192, 1345, 5824, 1977, 6456, 2609, 7088, 3241),
              as.vector(e1[1,])
              )

  e2     <- EvalItemValue(project.path, keys=c("IT", "CAR"), value="VALUE2")
  e2.bis <- EvalItemFromProjectData(project.path, c("IT", "CAR"), value="VALUE2")
  checkEquals(
              e2,
              e2.bis
              )
  checkEquals(
              c(6847, 7388, 6895, 7436, 6942, 7483, 6990, 7531),
              as.vector(e2[1,])
              )
  checkEquals(
              c("2011-1", "2011-2", "2012-1", "2012-2", "2013-1", "2013-2", "2014-1", "2014-2"),
              colnames(e2)
              )

  
  ## aggiungere qui' delle chiamate dirette alla funzione ltp()
  ## item.data = ...
  ## model = ltp(...)
  ## e fare qualche checkEquals tra i valori di model
}
